unit u_pesquisaposologia_ff;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, u_pesquisapadrao, FMTBcd, DB, DBClient, Provider, SqlExpr,
  ExtCtrls, AdvGlowButton, StdCtrls, Grids, DBGrids, JvExDBGrids, JvDBGrid,
  AdvEdit, AdvGroupBox;

type
  TFRM_PesquisaPosologiaFF = class(TFRM_PesquisaPadrao)
    cdsPesquisarCOD_POSOLOGIA: TIntegerField;
    cdsPesquisarDESCRICAO: TStringField;
    cdsPesquisarDATA_CAD: TDateField;
    cdsPesquisarDATA_ALTERACAO: TDateField;
    procedure edtPesquisarKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure FormShow(Sender: TObject);

  public
    function PesquisarListaPosologiaFF(CodForma: integer): boolean;
  end;

var
  FRM_PesquisaPosologiaFF: TFRM_PesquisaPosologiaFF;

implementation

{$R *.dfm}

procedure TFRM_PesquisaPosologiaFF.edtPesquisarKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
  cdsPesquisar.Locate('descricao',edtPesquisar.Text,[loPartialKey,loCaseInsensitive]);
end;

function TFRM_PesquisaPosologiaFF.PesquisarListaPosologiaFF(CodForma: integer): boolean;
begin
  cdsPesquisar.Close;
  sqlPesquisar.Params[0].AsInteger := CodForma;
  cdsPesquisar.Open;

  Result := not cdsPesquisar.IsEmpty;
end;

procedure TFRM_PesquisaPosologiaFF.FormShow(Sender: TObject);
begin
  inherited;
  lblTotal.Caption := lblTotal.Caption + ' posologias';
end;

end.
